[taskprocessing] Add an endpoint to get the position of a scheduled task in the queue - #62414
[taskprocessing] Add an endpoint to get the position of a scheduled task in the queue#62414julien-nc wants to merge 1 commit into
Conversation
559558d to
92bb9ac
Compare
| } | ||
|
|
||
| try { | ||
| return 1 + $this->taskMapper->countPendingTasksBefore($taskEntity->getLastUpdated()); |
There was a problem hiding this comment.
Should we filter by task type here?
There was a problem hiding this comment.
Not sure, if we think of exApps, makes sense to consider there is one queue per task type (even if some exApps implement providers for multiple task types), but with Php providers, the workers are common for all task types.
92bb9ac to
6a41cfd
Compare
…led task in the queue Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
6a41cfd to
3d7c551
Compare
kyteinsky
left a comment
There was a problem hiding this comment.
looks good!
(nit) what do you think about using notify_push in addition to this?
for sync providers, an update can be fired in the process or claim (used by taskproc worker) function so every time a task is picked (SCHEDULED -> RUNNING), the frontend would know the queue moved, maybe there's a chance of de-sync since frontend would first get the queue position and then decrement for each update but this is not that critical I suppose.
for async providers, this can be done in the next_task function.
it would be essentially the same path as the streaming outputs.
|
@kyteinsky I think we need as much reactivity as possible when displaying a task's output. But we don't need to be that fast/reactive when showing the queue info IMHO. Using notify_push here would make the assistant's UI implementation a little bit more complex for a very small gain. Wdyt? |
|
I was thinking more in the performance area, this polling would be done by every user who schedules a task in assistant so could be a load on the server and db. With notify_push, it would be event based and only one php call would send out updates to all the listening users. |
GET
/ocs/v2.php/taskprocessing/tasks/TASK_ID/queue_positionreturns the number of scheduled tasks that are older than the TASK_ID one (+1).
Checklist
3. to review, feature component)stable32)AI (if applicable)